<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="mvc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; utf-8">
    <title><s:text name="application.name" /></title>
</head>
<body>


<s:form action="/image/upload!upload" method="post" enctype="multipart/form-data">
    <%
        String fieldNumString = request.getParameter("fieldNum");
        Integer fieldNum = 3;
        if (fieldNumString != null && StringUtils.isNumeric(fieldNumString)) {
            fieldNum = Integer.parseInt(fieldNumString);
        }
        for (int i = 0; i < fieldNum; i++) {
    %>
        <s:file key="form.file" name="upload"/>
    <% } %>
    <s:submit />
</s:form>

<s:form id="fieldNumForm" method="">
    <s:select list="{1, 2, 3, 5, 10, 20}" value="3" key="image.fields.num" name="fieldNum" onchange="document.getElementById('fieldNumForm').submit();" />
</s:form>


</body>
</html>